The life saver HttpContext.Current.Items["ParameterName"]

Posted by MoezMousavi on Geeks with Blogs See other posts from Geeks with Blogs or by MoezMousavi
Published on Wed, 29 Dec 2010 23:33:04 GMT Indexed on 2010/12/29 13:54 UTC
Read the original article Hit count: 193

Filed under:

I got stocked passing parameter to one master page for some reasons, seems the page lifecycle and dynamic loading of the master pages has got some issues with defining public properties in the masterpage within my project. It did not set my values and as a result, properties became useless.

A collegue just mentioned using HttpContext. have a look what  MSDN saying "Encapsulates all HTTP-specific information about an individual HTTP request" http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx

HttpContext.Current.Items["ParameterName"]

Also, Page.Items could do the same thing. Page.Items, "Gets a list of objects stored in the page context" http://msdn.microsoft.com/en-us/library/system.web.ui.page.items.aspx as your master page and content page are rendered as a single document anyway.

 

 

© Geeks with Blogs or respective owner